<?php
    $result = mysqli_connect('localhost','root','root');
    if(!$result){
        echo "数据库连接失败";
    }
    mysqli_query($result,"set names 'utf8'");
    $select_db = mysqli_select_db($result,"lam");
    if(!$select_db){
        echo "不能连接到此数据库:\n".mysqli_error();
    }
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>lam_print</title>
    <link rel='stylesheet' href='css/subpage.css'>
    <link rel="stylesheet" href="css/nav.css">
</head>
<body id="lam_body">
    <?php
        $sql = "select id,txtName,txtMessage,addtime from guestbook order by addtime desc";
        $re = mysqli_query($result,$sql);
        while($row = mysqli_fetch_assoc($re)){
    ?>
    <div class="con_liuyan">
        <div id="print_table">
            <div id="print_tr1">
                <p class="input_p">标题&nbsp;:&nbsp;<?php echo $row['txtName']; ?>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo date('Y-m-d H:i:s',$row['addtime']); ?>&nbsp;&nbsp;&nbsp;&nbsp;<a class="lam_a" href="javascript:;" onclick="if(confirm('是否确认删除？')){location.href='./lam_del.php?id=<?php echo $row['id']; ?>';}" >[删除]</a></p>
            </div>
            <div class="none_print"></div>
            <div id="print_tr2">
                <p class="input_p">内容&nbsp;:&nbsp;<?php echo $row['txtMessage']; ?></p>
            </div>
        </div>
    </div>
    <?php
        }
    ?>
</body>
</html>